<template>
	<view>
		<view class="main" style="display: block;float: left;">
			<view class="center_qb t23">营业执照资料</view>
			<!-- <view class="center_qb t1">请填写商家的营业执照/登记证书、经营者/法人的证件等信息。</view> -->
			<view class="baodan_zhu t1" style="width: 100%;margin: 0; margin-top: 4vw; position: relative;">
				<view class="baodan_tit t1">请上传营业执照照片</view>
				<view class="uni-padding-wrap uni-common-mt baodan_into" @click="yyzzup">
					<block v-if="yyzz">
						<image :src="yyzz" class="image baodan_into_image" mode="widthFix"></image>
					</block>
				</view>
			
			</view>
			<view class="shuru">
				<text class="shuru_tit t1">商户名称</text>
				<input type="text" class="shuru_text t1" value="" v-model="merchantName" placeholder="示例值：张三餐饮店" />
			</view>
			<view class="shuru" @click="yyDatePickShow = true">
				<text class="shuru_tit t1">注册时间</text>
				<!-- <picker mode="date" :value="zdate" :start="zstartDate" :end="zendDate" @change="zbindDateChange">
					<view class="shuru_text t1">{{zdate}}</view>
				</picker> -->
				<view class="shuru_text t1">{{zdate}}</view>
			</view>
			
			<view class="shuru">
				<text class="shuru_tit t1">统一社会信用代码</text>
				<input type="text" class="shuru_text t1" value="" v-model="licenseNumber"
					placeholder="示例值：123456789012345678" />
			</view>
		<!-- 	<view class="shuru">
				<text class="shuru_tit t1">经营者姓名</text>
				<input type="text" class="shuru_text t1" value="" v-model="jyname" placeholder="请输入经营者姓名" />
			</view> -->
			<view class="shuru">
				<text class="shuru_tit t1">经营范围</text>
				<input type="text" class="shuru_text t1" value="" v-model="jyfanwei" placeholder="请输入经营范围" />
			</view>
			<view class="shuru">
				<text class="shuru_tit t1">经营类型</text>
				<picker @change="bindPickerChange" :range="array" range-key="name" class="shuru_text2 t1">
					{{array[index].name}}
				</picker>
			</view>
			<!-- <view class="shuru" v-if="array[index].id == 2">
				<text class="shuru_tit t1">下载授权函模版</text>
				<input type="text" class="shuru_text t1" value="点击下载" disabled @click="downLoadSqFile" />
			</view>
			<view class="baodan_zhu t1" style="width: 100%;margin: 0; margin-top: 4vw; position: relative;" v-if="array[index].id == 2">
				<view class="baodan_tit t1">APP授权函</view>
				<view class="uni-padding-wrap uni-common-mt baodan_into" @click="appsqhUp">
					<block>
						<image :src="sqhQiniu" class="image baodan_into_image" mode="widthFix"></image>
					</block>
				</view>
			</view> -->
			
			<view class="center_qb t23">门店资料</view>
			<view class="shuru">
				<text class="shuru_tit t1">门店名称</text>
				<input type="text" class="shuru_text t1" value="" v-model="shmd" placeholder="请输入门店名称" />
			</view>

			<!-- <view class="shuru">
				<text class="shuru_tit t1">客服电话</text>
				<input type="text" class="shuru_text t1" value="" v-model="kefu" placeholder="请输入客服电话" />
			</view> -->

			<!-- <view class="shuru">
				<text class="shuru_tit t1">门店类型</text>
				<picker @change="jycj" class="shuru_text2 t1" :range="jyarray" range-key="name">{{jyarray[jindex].name}}
				</picker>
			</view> -->
			<view class="shuru">
				<text class="shuru_tit t1" style="width:40%;display: block;float: left;height: auto;">门店所属地区</text>
				<picker mode="multiSelector" @columnchange="xuanzediqu" :value="dmultiIndex" :range="dmultiArray">
					<view class="shuru_text2 t1" v-if="diqu!=''" style="min-height: 10vw;width: 60%;">
						{{diqu}}
					</view>
					<view class="shuru_text2 t1" v-if="diqu==''" style="min-height: 10vw;width: 60%;">
						{{dmultiArray[0][dmultiIndex[0]]}}，{{dmultiArray[1][dmultiIndex[1]]}}，{{dmultiArray[2][dmultiIndex[2]]}}，{{dmultiArray[3][dmultiIndex[3]]}}
					</view>

				</picker>
			</view>
			<view class="shuru">
				<text class="shuru_tit t1">门店详细位置</text>
				<text class="shuru_text2 t1" @click="dingwei()">{{adrname}}

				</text>
			</view>
			<view class="shuru">
				<text class="shuru_tit t1">门店详细地址</text>
				<input type="text" class="shuru_text t1" value="" v-model="mdxxdz" placeholder="xx大厦x层xxxx室" />
			</view>
			<view class="baodan_zhu t1" style="width: 100%;margin: 0;margin-top: 4vw;">
				<view class="baodan_tit1 t1">门店门头照片</view>
				<view class="uni-padding-wrap uni-common-mt baodan_into1" @click="chooseImage1">
				</view>
				<view class="imgi" v-for="(item,index) in mdlist" :key="'d'+index">
					<image src="../../static/img/clo.png" class="del" @click="imgdel(item,0)"></image>
					<image :src="item" mode="aspectFill"></image>
				</view>
			</view>
			<view class="baodan_zhu t1" style="width: 100%;margin: 0;margin-top: 4vw;">
				<view class="baodan_tit1 t1">店内环境照片(选填)</view>
				<view class="uni-padding-wrap uni-common-mt baodan_into1" @click="chooseImage2">
				</view>
				<view class="imgi" v-for="(item,index) in dnlist" :key="'n'+index">
					<image src="../../static/img/clo.png" class="del" @click="imgdel(item,1)"></image>
					<image :src="item" mode="aspectFill"></image>
				</view>
			</view>
			<!-- <view> -->
			<view class="center_qb t23" style="margin-top: 8vw;">经营者/法人身份证信息</view>
			<view class="baodan_zhu t1">
				<view class="baodan_tit t1">身份证人像面照片</view>
				<view class="uni-padding-wrap uni-common-mt baodan_into" @click="fchooseImage">
					<block v-if="fimage">
						<image :src="fimage" class="image baodan_into_image" mode="widthFix"></image>
					</block>
				</view>
			</view>
			<view class="baodan_zhu t1">
				<view class="baodan_tit t1">身份证国徽面照片</view>
				<view class="uni-padding-wrap uni-common-mt baodan_into" @click="fchooseImage1">
					<block v-if="fimage1">
						<image :src="fimage1" class="image baodan_into_image" mode="widthFix"></image>
					</block>
				</view>
			</view>
			<view class="shuru">
				<text class="shuru_tit t1">身份证姓名</text>
				<input type="text" class="shuru_text t1" value="" v-model="fname" placeholder="请输入法人对应身份证的姓名" />
			</view>
			<view class="shuru">
				<text class="shuru_tit t1">身份证号码</text>
				<input type="text" class="shuru_text t1" value="" v-model="fnumber" placeholder="请输入法人对应身份证的号码" />
			</view>
			<view class="shuru" @click="fDatePickShow = true">
				<text class="shuru_tit t1">身份证有效期开始时间</text>
				<!-- <picker mode="date" :value="fdate" :start="fstartDate" :end="fendDate" @change="fbindDateChange"
					class="shuru_text2 t1">
					<view class="t1">{{fdate}}</view>
				</picker> -->
				<view class="shuru_text t1">{{fdate}}</view>
			</view>
			<view class="shuru">
				<text class="shuru_tit t1">身份证有效期年限</text>
				<picker @change="bindPickerChange4" :range="array4" class="shuru_text2 t1">
					{{array4[index4]}}
				</picker>
			</view>
			<view class="center_qb t23" style="margin-top: 8vw;">经营者/法人是否为受益人</view>
			<!-- <view class="center_qb t1">请填写商家的营业执照/登记证书、经营者/法人的证件等信息。</view> -->
			<view class="shuru">
				<text class="shuru_tit t1" style="width: 70%;">经营者/法人是否为受益人</text>
				<picker @change="bindPickerChange2" :range="array3" range-key="tit" class="shuru_text2 t1"
					style="width: 20%;">{{array3[index3]}}
				</picker>
			</view>

			<view v-show="han">
				<view class="center_qb t23" style="margin-top: 8vw;">最终受益人信息(UBO)</view>
				<view class="center_qb t1"> 若经营者/法人不是最终受益所有人，则需提填写受益所有人信息。</view>
				<view class="center_qb t23" style="margin-top: 8vw;">身份证信息</view>
				<view class="baodan_zhu t1">
					<view class="baodan_tit t1">身份证人像面照片</view>
					<view class="uni-padding-wrap uni-common-mt baodan_into" @click="schooseImage">
						<block v-if="simage">
							<image :src="simage" class="image baodan_into_image" mode="widthFix"></image>
						</block>
					</view>
				</view>
				<view class="baodan_zhu t1">
					<view class="baodan_tit t1">身份证国徽面照片</view>
					<view class="uni-padding-wrap uni-common-mt baodan_into" @click="schooseImage1">
						<block v-if="simage1">
							<image :src="simage1" class="image baodan_into_image" mode="widthFix"></image>
						</block>
					</view>
				</view>
				<view class="shuru">
					<text class="shuru_tit t1">身份证姓名</text>
					<input type="text" class="shuru_text t1" value="" v-model="sname" placeholder="请填写最终受益人对应身份证的姓名" />
				</view>
				<view class="shuru">
					<text class="shuru_tit t1">身份证号码</text>
					<input type="text" class="shuru_text t1" value="" v-model="snumber"
						placeholder="请填写最终受益人对应身份证的号码" />
				</view>

				<view class="shuru" @click="sDatePickShow = true">
					<text class="shuru_tit t1">身份证有效期开始时间</text>
					<!-- <picker mode="date" :value="sdate2" :start="sstartDate2" :end="sendDate2"
						@change="sbindDateChange2">
						<view class="shuru_text t1">{{sdate2}}</view>
					</picker> -->
					<view class="shuru_text t1">{{sdate2}}</view>
				</view>
				<view class="shuru">
					<text class="shuru_tit t1">身份证有效期年限</text>
					<picker @change="bindPickerChange5" :range="array5" class="shuru_text2 t1">
						{{array5[index5]}}
					</picker>
				</view>
			</view>
				<view class="center_qb t13" v-if="strs!=''">错误提示：{{strs}}</view>
			<view class="tuic tuic11 t2" @click="queding()" style="width: 100%;margin: 10vw 0;">下一步</view>
			<!-- <view class="tuic2 t2" @click="xiugai()" v-if="types==2" style="width: 100%;margin: 0;margin-bottom: 10vw;">
				修改</view> -->
			<view class="bai"></view>
		</view>
		<!-- 营业执照注册时间 -->
		<u-picker mode="time" v-model="yyDatePickShow" :params="params" :default-time="zdate" @confirm="yyDateConfirm"></u-picker>
		<!-- 法人身份证有效期 -->
		<u-picker mode="time" v-model="fDatePickShow" :params="params" :default-time="fdate" @confirm="fDateConfirm"></u-picker>
		<!-- 经营者身份证有效期 -->
		<u-picker mode="time" v-model="sDatePickShow" :params="params" :default-time="sdate2" @confirm="sDateConfirm"></u-picker>
	</view>
	<!-- </view> -->
</template>

<script>
	import permision from "@/js_sdk/wa-permission/permission.js";

	function getDate(type) {
		const date = new Date();

		let year = date.getFullYear();
		let month = date.getMonth() + 1;
		let day = date.getDate();

		if (type === 'start') {
			year = year - 30;
		} else if (type === 'end') {
			year = year + 30;
		} else if (type === 'endi') {
			return '长期';
		}
		month = month > 9 ? month : '0' + month;;
		day = day > 9 ? day : '0' + day;

		return `${year}-${month}-${day}`;
	}
	export default {
		data() {
			return {
				sqhQiniu: "",//app授权函文件地址
				sqhUrl: "",//app授权函服务器需要的地址
				params: {
					year: true,
					month: true,
					day: true,
					hour: false,
					minute: false,
					second: false
				},
				// 营业执照的日期选择
				yyDatePickShow: false,
				// 法人身份证有效期的日期选择
				fDatePickShow: false,
				// 经营者身份证有效期的日期选择
				sDatePickShow: false,
				imgfo: 1,
				han: false,
				index: 0,
				index2: 0,
				array4: ['5年', '10年', '20年', '长期'],
				array5: ['5年', '10年', '20年', '长期'],
				jyarray: [{
					name: '',
					id: ''
				}],
				jindex: 0,
				qi: '',
				types: 1,
				mainid: '', //	用户ID（mainId）		true					string
				licenseNumber: '', //	营业执照编码		true					string
				merchantName: '', //	商户名称		true					string
				subjectType: '', //	主体类型		true					string
				index3: 0,
				fdate: getDate({
					format: true
				}),
				fstartDate: getDate('start'),
				fendDate: getDate('end'),
				fdate1: getDate({
					format: true
				}),
				sdate2: getDate({
					format: true
				}),
				sstartDate2: getDate('start'),
				sendDate2: getDate('end'),
				sdate3: getDate({
					format: true
				}),
				array3: ['是', '否'],
				mainPicId: '', //	证件正面图		true	string
				fname: '',
				fnumber: '',
				periodEnd: '', //	有效期结束		true	string
				periodStart: '', //	有效期开始		true	string
				secondPicId: '', //	证件反面图		true	string
				fimage: '',
				fimage1: '',
				smainPicId: '', //	证件正面图		true	string
				sname: '', //	姓名		true	string
				snumber: '', //	证件号		true	string
				speriodEnd: '', //	有效期结束		true	string
				speriodStart: '', //	有效期开始		true	string
				ssecondPicId: '', //	证件反面图		true	string
				stypeId: '', //	证件类型ID(默认 身份证)
				smainPicId1: '', //	证件正面图		true	string
				sname1: '', //	姓名		true	string
				speriodEnd1: '', //	有效期结束		true	string
				speriodStart1: '', //	有效期开始		true	string
				ssecondPicId1: '', //	证件反面图		true	string
				stypeId1: '', //	证件类型ID(默认 身份证)
				simage: '',
				simage1: '',
				yyzz: '',
				yyzzid: '',
				yyzzimg: '', //用来上传图片的时候显示加载效果
				shmd: '',
				sfzAddress: '',//身份证地址
				zdate: getDate({
					format: true
				}),
				zstartDate: getDate('start'),
				zendDate: getDate('end'),
				adrid: '',
				adrname: '',
				latitude: '',
				longitude: '',
				darray: [{
					name: '',
					id: ''
				}],
				dnui1: [],
				dnui2: [],
				dnui3: [],
				dnui4: [],
				dmultiArray: [
					[],
					[],
					[],
					[],
				],
				dmultiIndex: [0, 0, 0, 0],
				dpickerid1: '',
				dpickerid2: '',
				dpickerid3: '',
				dpickerid4: '',
				communitys: '',
				community: '',
				dpid: '',
				provinceId: '',
				cityId: '',
				districtId: '',
				areaId: '',
				mdxxdz1: '',
				mdxxdz: '',
				diqu: '',
				jyname: '',
				jyfanwei: '',
				// dindex: 0,
				array: [{
					name: '',
					id: ''
				}],
				dnlist: [],
				mdlist: [],
				dnidlist: [],
				mdidlist: [],
				kefu: '',
				jycjid: '',
				addressId: '',
				dnidlisti: '',
				mdidlisti: '',
				strs: '',
				index4: 0,
				index5: 0,
			}
		},

		onLoad() {
			var _this = this;
			uni.getStorage({
				key: 'user',
				success: function(res) {
					_this.mainid = res.data.id;
					// console.log(res);
					_this.jychangjing();
					_this.dadr();
					_this.zttype();
					// _this.info();
					setTimeout(function() {
						_this.info();
						_this.jyinfo();
					}, 500);
				}
			});
			this.speriodEnd = this.sdate3
			this.speriodStart = this.sdate2
			this.periodEnd = this.fdate1
			this.periodStart = this.fdate
		},
		onShow() {},
		methods: {
			/**
			 * 下载授权函模版(备用)
			 * */ 
			downloadPlusApp() {
				var url = "http://admin.zhaocaiami.vworld365.com/APP.docx"
				let dtask = plus.downloader.createDownload(url, {
					//本地路径开头使用file://，跟上手机文件本地目录storage/emulated/0，就是用户文件管理器能看到的了，之后我创建微垠作为文件夹，后缀是用于文件命名和格式修改，大家可以使用变量。
					filename: "_doc/download/" + "APP授权函.docx" //利用保存路径，实现下载文件的重命名
				}, 
				function(d, status) {
					//d为下载的文件对象
					console.log("dd",d);
					if (status == 200) {
						//下载成功,d.filename是文件在保存在本地的相对路径，使用下面的API可转为平台绝对路径
						let fileSaveUrl = plus.io.convertLocalFileSystemURL(d.filename);
						plus.runtime.openFile(d.filename); //选择软件打开文件
					} else {
						//下载失败
						plus.downloader.clear(); //清除下载任务
					}
				})
				dtask.start();
			},
			/**
			 * 下载授权函模版
			 * */ 
			downLoadSqFile(){
				uni.showLoading({
					title: '下载中，请稍候...',
					mask: true
				});
				uni.downloadFile({
					url: 'http://admin.zhaocaiami.vworld365.com/APP.docx', //仅为示例，并非真实的资源
					success: (res) => {
						if (res.statusCode === 200) {
							console.log('下载成功',res);
							uni.hideLoading();
							var filePath = res.tempFilePath;
							uni.openDocument({
								filePath: filePath,
								showMenu: true,
								success: function (res) {
									console.log('打开文档成功');
								}
							});
						}
					}
				});
			},
			// app授权函上传
			appsqhUp(){
				var _this = this;
				uni.chooseImage({
					count: 1,
					sizeType: ['compressed'],
					success: function(res) {
						console.log(res);
						var tempFilePaths = res.tempFilePaths;
						uni.showLoading({
							title: '上传中...',
							mask: true
						});
						var uploadTask = uni.uploadFile({
							url: getApp().globalData.url + 'file/uploadLicense',
							filePath: tempFilePaths[0],
							name: 'file',
							formData: {},
							success: function(uploadFileRes) {
								uni.hideLoading();
								var datamain = JSON.parse(uploadFileRes.data);
								console.log('app授权函上传：',datamain);
								if (datamain.status == 200) {
									_this.sqhUrl = datamain.data.localRoot + datamain.data.localPath;
									_this.sqhQiniu = datamain.data.domain + datamain.data.localPath;
								} else {
									uni.showToast({
										title: datamain.msg,
										icon: 'none',
										duration: 1000
									})
								}
							},
							fail(e) {
								uni.hideLoading();
								uni.showToast({
									title: '上传失败',
									icon: 'none',
									duration: 1000
								})
							}
						});
				
					},
					error: function(e) {
						uni.showToast({
							title: '文件选择失败',
							icon: 'none',
							duration: 1000
						})
					}
				});
			},
			// 营业执照的注册时间选择
			yyDateConfirm(date){
				this.zdate = date.year + "-" + date.month + "-" + date.day;
			},
			// 法人身份证有效期
			fDateConfirm(date){
				this.fdate = date.year + "-" + date.month + "-" + date.day;
			},
			// 法人身份证有效期
			sDateConfirm(date){
				this.sdate2 = date.year + "-" + date.month + "-" + date.day;
			},
			imgdel(img, i) {
				console.log(img)
				console.log(i)
				if (i == 0) {
					var idlist = [];
					var list = [];
					for (var i = 0; i < this.mdlist.length; i++) {
						if (img != this.mdlist[i]) {
							idlist.push(this.mdidlist[i]);
							list.push(this.mdlist[i]);
						}
					}
					this.mdidlist = idlist;
					this.mdlist = list;
				} else {
					var idlist = [];
					var list = [];
					for (var i = 0; i < this.dnlist.length; i++) {
						if (img != this.dnlist[i]) {
							idlist.push(this.dnidlist[i]);
							list.push(this.dnlist[i]);
						}
					}
					this.dnidlist = idlist;
					this.dnlist = list;
				}
			},
			
			// 上传店内图片
			chooseImage2: function() {
				var _this = this;
				uni.chooseImage({
					count: 9,
					sizeType: ['compressed'],
					success: function(res) {
						var len = res.tempFilePaths.length;
						console.log(res.tempFilePaths);
						for (var i = 0; i < len; i++) {
							// _this.proimg = res.tempFilePaths[0];
							var tempFilePaths = res.tempFilePaths;
							// console.log(_this.token);
							var uploadTask = uni.uploadFile({
								url: getApp().globalData.url + 'file/uploadThird',
								filePath: tempFilePaths[i],
								name: 'file',
								formData: {
									// 'files':tempFilePaths[i],
								},
								success: function(uploadFileRes) {
									var datamain = JSON.parse(uploadFileRes.data);
									if (datamain.status == 200) {
										_this.dnlist.push(datamain.data.domain + datamain.data
											.localPath);
										_this.dnidlist.push(datamain.data.id);
									} else {
										uni.showToast({
											title: datamain.msg,
											icon: 'none',
											duration: 1000
										})
									}
								}
							});

							uploadTask.onProgressUpdate(function(res) {});
						}


					},
					error: function(e) {
						console.log(e);
						uni.showToast({
							title: '上传失败',
							icon: 'none',
							duration: 1000
						})
					}
				});

			},
			// 上传门头图片
			chooseImage1: function() {
				var _this = this;
				uni.chooseImage({
					count: 9,
					sizeType: ['compressed'],
					success: function(res) {
						var len = res.tempFilePaths.length;
						// console.log(res.tempFilePaths);
						for (var i = 0; i < len; i++) {
							// _this.proimg = res.tempFilePaths[0];
							var tempFilePaths = res.tempFilePaths;
							// console.log(tempFilePaths[i]);
							var uploadTask = uni.uploadFile({
								url: getApp().globalData.url + 'file/uploadThird',
								filePath: tempFilePaths[i],
								name: 'file',
								formData: {
									// 'files':tempFilePaths[i],
								},
								success: function(uploadFileRes) {
									var datamain = JSON.parse(uploadFileRes.data);
// console.log(datamain)
									if (datamain.status == 200) {
										_this.mdlist.push(datamain.data.domain + datamain.data
											.localPath);
										_this.mdidlist.push(datamain.data.id);
									} else {
										uni.showToast({
											title: datamain.msg,
											icon: 'none',
											duration: 1000
										})
									}
								},fail(e) {
									// console.log(e)
								}
							});

							uploadTask.onProgressUpdate(function(res) {});
						}


					},
					error: function(e) {
						console.log(e);
						uni.showToast({
							title: '上传失败',
							icon: 'none',
							duration: 1000
						})
					}
				});

			},
			// 获取经营资料
			jyinfo() {
				var _this = this;
				uni.request({
					header: {
						'Content-Type': 'application/x-www-form-urlencoded', //自定义请求头信息
					},
					url: getApp().globalData.url + 'mch/getInfo/' + _this.mainid, //仅为示例，并非真实接口地址。
					method: 'post',
					data: {
						id: _this.mainid //	用户ID（mainId）
					},
					success: (res) => {
						console.log(res);
						if (res.data.status == '200') {
							// 经营资料					
						if (res.data.data) {
							_this.kefu = res.data.data.phone;
							_this.shmd = res.data.data.shortName;

							if (res.data.data.mainPics.length > 0) {
								_this.mdlist = [];
								for (var i = 0; i < res.data.data.mainPics.length; i++) {
									// console.log(i);
									var mimg = res.data.data.mainPics[i].domain + res.data.data.mainPics[i]
										.localPath
									_this.mdlist.push(mimg);
									_this.mdidlist.push(res.data.data.mainPics[i].id);
								}
							}
							if (res.data.data.secondPics.length > 0) {
								_this.dnlist = [];
								for (var i = 0; i < res.data.data.secondPics.length; i++) {
									var mimg = res.data.data.secondPics[i].domain + res.data.data.secondPics[i]
										.localPath
									_this.dnlist.push(mimg);
									_this.dnidlist.push(res.data.data.secondPics[i].id);
								}
							}
							// 门店类型
							_this.jycjid = res.data.data.scenesType.id;
							// console.log(_this.jycjid);
							// console.log(_this.jyarray);
							for (var i = 0; i < _this.jyarray.length; i++) {
								if (_this.jycjid == _this.jyarray[i].id) {
									// console.log(_this.jyarray[i]);
									_this.jindex = i;
									// if (_this.jyarray[i].name == '公众号') {
									// 	_this.imgfo = 0;
									// } else {
									// 	_this.imgfo = 1;
									// }
								}
							}
}
						}else{
							uni.showToast({
								title: '获取经营资料失败',
								icon: 'none',
								duration: 1000
							})
						}
					},
					fail: (error) => {
							uni.showToast({
								title: '获取经营资料失败',
								icon: 'none',
								duration: 1000
							})
					}
				});
			},
			// 门店类型
			jychangjing() {
				var _this = this;
				uni.request({
					header: {
						'Content-Type': 'application/json', //自定义请求头信息
					},
					url: getApp().globalData.url + 'mch/getScenesTypeList', //仅为示例，并非真实接口地址。
					method: 'post',
					data: {
						// id: _this.mainid //	用户ID（mainId）
					},
					success: (res) => {
						// console.log(res);
						if (res.data.status == '200') {
							_this.jyarray = res.data.data;
							_this.jycjid = _this.jyarray[0].id;

							// console.log(_this.jycjid);
						}else{
							
								uni.showToast({
									title: '获取门店类型失败',
									icon: 'none',
									duration: 1000
								})
						}
					},
					fail: (error) => {
							uni.showToast({
								title: '获取门店类型失败',
								icon: 'none',
								duration: 1000
							})
					}
				});
			},
			async requestAndroidPermission(permisionID) {
				var result = await permision.requestAndroidPermission(permisionID)
				var strStatus
				// console.log(result)
				if (result == 1) {
					strStatus = "已获得授权"
				} else if (result == 0) {
					strStatus = "未获得授权"
					uni.showModal({
						content: '您已拒绝获取定位权限，请到设置中去打开此权限',
						showCancel: false
					});
				} else {
					uni.showModal({
						content: '您已拒绝获取定位权限，请到设置中去打开此权限',
						showCancel: false
					});
					// strStatus = "被永久拒绝权限"
				}
				// uni.showModal({
				// 	content: permisionID + strStatus,
				// 	showCancel: false
				// });
			},
			dingwei() {
				var that = this;
				that.requestAndroidPermission('android.permission.ACCESS_FINE_LOCATION');
				uni.chooseLocation({
					success: function(res) {
						that.adrname = res.address;
						that.latitude = res.latitude;
						that.longitude = res.longitude;
					}
				});
			},
			zbindDateChange: function(e) {
				console.log(e.detail.value);
				this.zdate = e.detail.value
				// this.zctime = e.detail.value
			},
			dadr() {
				var _this = this;
				uni.request({
					header: {
						'Content-Type': 'application/x-www-form-urlencoded', //自定义请求头信息
					},
					url: getApp().globalData.url + 'area/areaList/', //仅为示例，并非真实接口地址。
					method: 'POST',
					data: {
						parentId: ''
					},
					success: (res) => {
						if (res.data.status == '200') {
								if(res.data.data.length>0){
							_this.dnui1 = res.data.data;
							for (var i = 0; i < res.data.data.length; i++) {
								_this.dmultiArray[0].push(res.data.data[i].name);
							}
							_this.dpickerid1 = res.data.data[0].id;
							// _this.pid = res.data.data[0].id;
							_this.dadr1();
								}
						}else{
							
								uni.showToast({
									title: '获取省信息失败',
									icon: 'none',
									duration: 1000
								})
						}
					},
					fail: (error) => {
						uni.showToast({
							title: '获取省信息失败',
							icon: 'none',
							duration: 1000
						})
					}
				});
			},
			dadr1() {
				var _this = this;
				uni.request({
					header: {
						'Content-Type': 'application/x-www-form-urlencoded', //自定义请求头信息
					},
					url: getApp().globalData.url + 'area/areaList/' + _this.dpickerid1, //仅为示例，并非真实接口地址。
					method: 'POST',
					data: {
						parentId: _this.dpickerid1 //	用户ID（mainId）
					},
					success: (res) => {
						if (res.data.status == '200') {
								if(res.data.data.length>0){
							_this.dnui2 = res.data.data;
							var list = [];
							for (var i = 0; i < res.data.data.length; i++) {
								list.push(res.data.data[i].name);
							}
							this.dmultiArray.splice(1, 1, list)
							if (!_this.dpickerid2) {
								_this.dpickerid2 = res.data.data[0].id;
							} else {
								// console.log(_this.dpickerid2);
								for (var i = 0; i < _this.dnui2.length; i++) {
									if (_this.dpickerid2 == _this.dnui2[i].id) {
										// console.log(_this.dnui2[i].id);console.log(i);
										_this.dmultiIndex[1] = i;
									}
								}
							}

							this.$forceUpdate();
							_this.dadr2();
								}
						}else{
							uni.showToast({
								title: '获取市信息失败',
								icon: 'none',
								duration: 1000
							})
						}
					},
					fail: (error) => {
						uni.showToast({
							title: '获取市信息失败',
							icon: 'none',
							duration: 1000
						})
					}
				});
			},
			dadr2() {
				var _this = this;
				uni.request({
					header: {
						'Content-Type': 'application/x-www-form-urlencoded', //自定义请求头信息
					},
					url: getApp().globalData.url + 'area/areaList/' + _this.dpickerid2, //仅为示例，并非真实接口地址。
					method: 'POST',
					data: {
						parentId: _this.dpickerid2 //	用户ID（mainId）
					},
					success: (res) => {
						if (res.data.status == '200') {
							if (res.data.data) {
								if(res.data.data.length>0){
								_this.dnui3 = res.data.data;
								var list = [];
								for (var i = 0; i < res.data.data.length; i++) {
									list.push(res.data.data[i].name);
								}
								this.dmultiArray.splice(2, 1, list)
								if (!_this.dpickerid3) {
									_this.dpickerid3 = res.data.data[0].id;
								} else {
									for (var i = 0; i < _this.dnui3.length; i++) {
										if (_this.dpickerid3 == _this.dnui3[i].id) {
											// console.log(_this.dnui2[i].id);console.log(i);
											_this.dmultiIndex[2] = i;
										}
									}
								}
								// console.log(_this.dpickerid3);
								this.$forceUpdate();
								// _this.qid = res.data.data[0].id;
								// _this.dpickerid3 = res.data.data[0].id;
								// _this.districtId = res.data.data[0].id;
								_this.dadr3();
								}
								// console.log(_this.bizAddressCode);
							}
						}else{
							uni.showToast({
								title: '获取区/县信息失败',
								icon: 'none',
								duration: 1000
							})
						}
					},
					fail: (error) => {
						
							uni.showToast({
								title: '获取区/县信息失败',
								icon: 'none',
								duration: 1000
							})
					}
				});
			},
			dadr3() {
				var _this = this;
				uni.request({
					header: {
						'Content-Type': 'application/x-www-form-urlencoded', //自定义请求头信息
					},
					url: getApp().globalData.url + 'area/areaList/' + _this.dpickerid3, //仅为示例，并非真实接口地址。
					method: 'POST',
					data: {
						parentId: _this.qid //	用户ID（mainId）
					},
					success: (res) => {
						if (res.data.status == '200') {
							// console.log(res.data.data);
							
									if(res.data.data.length>0){
								_this.dnui4 = res.data.data;
								var list = [];
								for (var i = 0; i < res.data.data.length; i++) {
									list.push(res.data.data[i].name);
								}
								_this.dmultiArray.splice(3, 1, list)
								if (!_this.dpickerid4) {
									_this.dpickerid4 = res.data.data[0].id;
								} else {
									for (var i = 0; i < _this.dnui4.length; i++) {
										if (_this.dpickerid4 == _this.dnui4[i].id) {
											// console.log(_this.dnui2[i].id);console.log(i);
											_this.dmultiIndex[3] = i;
										}
									}
								}
							}

						}else{
							uni.showToast({
								title: '获取乡镇/街道信息失败',
								icon: 'none',
								duration: 1000
							})
						}
					},
					fail: (error) => {
							uni.showToast({
								title: '获取乡镇/街道信息失败',
								icon: 'none',
								duration: 1000
							})
					}
				});
			},
			xuanzediqu: function(e) {
				var _this = this;
				// console.log(e.detail.column);
				_this.diqu = '';
				_this.adrname1 = '';
				_this.dmultiIndex[e.detail.column] = e.detail.value;
				if (e.detail.column == 0) {
					_this.dmultiArray.splice(1, 1, [])
					_this.dmultiArray.splice(2, 1, [])
					_this.dmultiArray.splice(3, 1, [])
					_this.dpickerid1 = _this.dnui1[e.detail.value].id;
					_this.dpickerid2 = '';
					_this.dpickerid3 = '';
					_this.dpickerid4 = '';
					// _this.provinceId = _this.dnui1[e.detail.value].id;
					_this.dmultiIndex = [e.detail.value, 0, 0, 0];
					_this.dadr1();
				} else if (e.detail.column == 1) {
					_this.dmultiArray.splice(2, 1, [])
					_this.dmultiArray.splice(3, 1, [])
					_this.dpickerid2 = _this.dnui2[e.detail.value].id;
					// _this.cityId = _this.dnui2[e.detail.value].id;
					_this.dpickerid3 = '';
					_this.dpickerid4 = '';
					_this.dmultiIndex[2] = 0;
					_this.dmultiIndex[3] = 0;
					// _this.bizAddressCode = _this.dnui2[e.detail.value].id;
					
					if(_this.dpickerid2){						
						_this.dadr2();
					}
				} else if (e.detail.column == 2) {
					_this.dmultiArray.splice(3, 1, [])
					_this.dpickerid3 = _this.dnui3[e.detail.value].id;
					_this.districtId = _this.dnui3[e.detail.value].id;
					_this.dpickerid4 = '';
					_this.dmultiIndex[3] = 0;
					
					if(_this.dpickerid3){						
						_this.dadr3();
					}
				} else if (e.detail.column == 3) {
					_this.dmultiIndex[3] = e.detail.value;
					_this.dpickerid4 = _this.dnui4[e.detail.value].id;
					_this.areaId = _this.dnui4[e.detail.value].id;
					// _this.xiaoqu();
				}
				this.$forceUpdate()
			},
			changjing() {
				var _this = this;
				uni.request({
					header: {
						'Content-Type': 'application/json', //自定义请求头信息
					},
					url: getApp().globalData.url + 'merchant/getSalesScenes', //仅为示例，并非真实接口地址。
					method: 'post',
					data: {
						id: _this.mainid //	用户ID（mainId）
					},
					success: (res) => {
						if (res.data.status == '200') {
							_this.array = res.data.data;
							_this.salesScenesType = _this.array[0].id;
						}
					},
					fail: (error) => {
						console.log(error)
					}
				});
			},

			bindPickerChange4: function(e) {
				this.index4 = e.detail.value
				console.log(this.index4);

			},
			bindPickerChange5: function(e) {
				this.index5 = e.detail.value
				console.log(this.index5);

			},
			// bindDateChange3: function(e) {
			// 	this.date3 = e.detail.value
			// },
			// bindDateChange2: function(e) {
			// 	this.date2 = e.detail.value
			// },
			// bindDateChange1: function(e) {
			// 	this.date1 = e.detail.value
			// },
			// bindDateChange: function(e) {
			// 	this.date = e.detail.value
			// },

			jycj: function(e) {
				var that = this;
				var ii = e.detail.value;
				that.jycjid = that.jyarray[ii].id;
				console.log(that.jycjid);
				// console.log(e.detail.value);
				// if (that.jyarray[ii].name == '公众号') {
				// 	that.imgfo = 0;
				// } else {
				// 	that.imgfo = 1;
				// }
				that.jindex = e.detail.value;
			},
			// jjlx: function(e) {
			// 	var that = this;
			// 	var ii = e.detail.value;
			// 	that.mindex = ii;
			// 	that.belongType = ii;
			// },
			yyzzup: function() {
				var _this = this;
				uni.chooseImage({
					count: 1,
					sizeType: ['compressed'],
					success: function(res) {
						console.log('营业执照：',res);
						_this.yyzzimg = 1;
						var tempFilePaths = res.tempFilePaths;
						_this.yyzz = tempFilePaths[0];
						// console.log(tempFilePaths[0]);
						uni.showLoading({
							title: '营业执照自动识别中，请稍候...',
							mask: true
						});
						var uploadTask = uni.uploadFile({
							url: getApp().globalData.url + 'file/uploadLicense',
							filePath: tempFilePaths[0],
							name: 'file',
							formData: {},
							success: function(uploadFileRes) {
								uni.hideLoading();
								console.log("uploadFileRes",uploadFileRes);
								_this.yyzzimg == '';
								var datamain = JSON.parse(uploadFileRes.data);
								// var datamain = uploadFileRes.data;
								console.log(datamain);
								console.log('营业执照上传：',datamain);
								if (datamain.status == 200) {
									var url = datamain.data.domain + datamain.data.localPath;
									_this.yyzz = url;
									_this.yyzzid = datamain.data.id;
									console.log(_this.yyzzid);
									console.log(url);
									var license = datamain.data.license;
									console.log("license",license);
									_this.licenseNumber = license.CreditCode;
									_this.merchantName = license.Entname;
									_this.jyfanwei = license.Zsopscope;
									_this.mdxxdz = license.Dom;
									
									var TypeName = license.Type;
									console.log("TypeName",TypeName);
									
									for (var i = 0; i < _this.array.length; i++) {
										if(_this.array[i].name == TypeName){
											_this.index = i;
											_this.subjectType = _this.array[i].id;
										}
									}
									console.log("自动识别出经营类型",_this.subjectType,_this.index);
									
									var year = license.SetDate.substring(0,4);
									var month = license.SetDate.substring(5,7);
									var day = license.SetDate.substring(8,10);
									
									_this.zdate = year + "-" + month + "-" + day;
								} else {
									uni.showToast({
										title: datamain.msg,
										icon: 'none',
										duration: 1000
									})
								}
							},
							fail(e) {
								uni.hideLoading();
								uni.showToast({
									title: '上传失败',
									icon: 'none',
									duration: 1000
								})
							}
						});

					},
					error: function(e) {
						_this.yyzzimg == '';
						console.log(e);
						uni.showToast({
							title: '上传失败',
							icon: 'none',
							duration: 1000
						})
					}
				});

			},

			bindPickerChange2: function(e) {
				var that = this;
				console.log('picker发送选择改变，携带值为：' + e.detail.value);
				var ii = e.detail.value;
				that.qi = that.array3[ii].id;
				that.index3 = e.detail.value
				console.log(that.index3);
				if (ii == 1) {
					that.snumber = '';
					that.han = true;
				} else {
					that.han = false;
				}
				console.log(that.han);
			},
			// bindPickerChange12: function(e) {
			// 	var that = this;
			// 	console.log('picker发送选择改变，携带值为：' + e.detail.value);
			// 	// console.log(e);
			// 	var ii = e.detail.value;
			// 	that.typeId = that.array22[ii].id;
			// 	if (ii == 0) {
			// 		that.sfz = true;
			// 		that.qita = false;
			// 	} else {
			// 		that.sfz = false;
			// 		that.qita = true;
			// 	}
			// },
			// bindPickerChange11: function(e) {
			// 	var that = this;
			// 	console.log('picker发送选择改变，携带值为：' + e.detail.value);
			// 	var ii = e.detail.value;
			// 	that.stypeId = that.array21[ii].id;
			// 	if (ii == 0) {
			// 		that.sfz1 = true;
			// 		that.qita1 = false;
			// 	} else {
			// 		that.sfz1 = false;
			// 		that.qita1 = true;
			// 	}
			// 	// console.log(that.sfz1, that.qita1);
			// },

			fchooseImage: function() {
				var _this = this;
				uni.chooseImage({
					count: 1,
					sizeType: ['compressed'],
					success: function(res) {
						var tempFilePaths = res.tempFilePaths;
						_this.fimage = tempFilePaths[0];
						uni.showLoading({
							title: '身份证自动识别中，请稍候...',
							mask: true
						});
						var uploadTask = uni.uploadFile({
							url: getApp().globalData.url + '/file/uploadIDCard',
							filePath: tempFilePaths[0],
							name: 'file',
							formData: {
								// 'files':tempFilePaths[i],
							},
							success: function(uploadFileRes) {
								uni.hideLoading();
								var datamain = JSON.parse(uploadFileRes.data);
								console.log('上传成功：',datamain);
								if (datamain.status == 200) {
									var url = datamain.data.domain + datamain.data.localPath;
									_this.fimage = url;
									_this.mainPicId = datamain.data.id;
									console.log(url);
									var idCord = datamain.data.idCord;
									console.log("idCord",idCord);
									_this.fname = idCord.Name;
									_this.fnumber = idCord.IdNum;
									_this.sfzAddress = idCord.address;

								} else {
									uni.showToast({
										title: datamain.msg,
										icon: 'none',
										duration: 1000
									})
								}
							},
							fail(e) {
								uni.hideLoading();
								uni.showToast({
									title: '上传失败',
									icon: 'none',
									duration: 1000
								})
							}
						});
					},
					error: function(e) {
						uni.hideLoading();
						console.log(e);
						uni.showToast({
							title: '上传失败',
							icon: 'none',
							duration: 1000
						})
					}
				});

			},
			fchooseImage1: function() {
				var _this = this;
				uni.chooseImage({
					count: 1,
					sizeType: ['compressed'],
					success: function(res) {
						var tempFilePaths = res.tempFilePaths;
						_this.fimage1 = tempFilePaths[0];
						uni.showLoading({
							title: '身份证自动识别中，请稍候...',
							mask: true
						});
						var uploadTask = uni.uploadFile({
							url: getApp().globalData.url + 'file/uploadIDCard',
							filePath: tempFilePaths[0],
							name: 'file',
							formData: {
								// 'files':tempFilePaths[i],
							},
							success: function(uploadFileRes) {
								uni.hideLoading();
								var datamain = JSON.parse(uploadFileRes.data);
								console.log("法人身份证反面信息",datamain);
								if (datamain.status == 200) {
									var url = datamain.data.domain + datamain.data.localPath;
									_this.fimage1 = url;
									_this.secondPicId = datamain.data.id;
									console.log(url);
									var idCord = datamain.data.idCord;
									console.log("idCord",idCord);
									var startDate = idCord.ValidDate.substring(0,10);
									var stratArr =  startDate.split(".");
									_this.fdate = stratArr.join("-");
									_this.periodStart = _this.fdate;
									
									var startYear = Number(idCord.ValidDate.substring(0,4));
									var endYear = Number(idCord.ValidDate.substring(11,15));
									console.log(startYear,endYear);
									var qixian = endYear - startYear;
									if(qixian == 5){
										_this.index4 = 0;
									}
									if(qixian == 10){
										_this.index4 = 1;
									}
									if(qixian == 20){
										_this.index4 = 2;
									}
								} else {
									uni.showToast({
										title: datamain.msg,
										icon: 'none',
										duration: 1000
									})
								}
							},
							fail(e) {
								uni.hideLoading();
								uni.showToast({
									title: '上传失败',
									icon: 'none',
									duration: 1000
								})
							}
						});
					},
					error: function(e) {
						console.log(e);
						uni.showToast({
							title: '上传失败',
							icon: 'none',
							duration: 1000
						})
					}
				});

			},
			schooseImage: function() {
				var _this = this;
				uni.chooseImage({
					count: 1,
					sizeType: ['compressed'],
					success: function(res) {
						var tempFilePaths = res.tempFilePaths;
						_this.simage = tempFilePaths[0];
						uni.showLoading({
							title: '身份证自动识别中，请稍候...',
							mask: true
						});
						var uploadTask = uni.uploadFile({
							url: getApp().globalData.url + 'file/uploadIDCard',
							filePath: tempFilePaths[0],
							name: 'file',
							formData: {
								// 'files':tempFilePaths[i],
							},
							success: function(uploadFileRes) {
								uni.hideLoading();
								var datamain = JSON.parse(uploadFileRes.data);
								console.log(datamain);
								if (datamain.status == 200) {
									var url = datamain.data.domain + datamain.data.localPath;
									_this.simage = url;
									_this.smainPicId = datamain.data.id;
									console.log(url);
									var idCord = datamain.data.idCord;
									console.log("idCord",idCord);
									_this.sname = idCord.Name;
									_this.snumber = idCord.IdNum;
								} else {
									uni.showToast({
										title: datamain.msg,
										icon: 'none',
										duration: 1000
									})
								}
							},
							fail(e) {
								uni.hideLoading();
								uni.showToast({
									title: '上传失败',
									icon: 'none',
									duration: 1000
								})
							}
						});
					},
					error: function(e) {
						console.log(e);
						uni.showToast({
							title: '上传失败',
							icon: 'none',
							duration: 1000
						})
					}
				});

			},
			schooseImage1: function() {
				var _this = this;
				uni.chooseImage({
					count: 1,
					sizeType: ['compressed'],
					success: function(res) {
						var tempFilePaths = res.tempFilePaths;
						_this.simage1 = tempFilePaths[0];
						uni.showLoading({
							title: '身份证自动识别中，请稍候...',
							mask: true
						});
						var uploadTask = uni.uploadFile({
							url: getApp().globalData.url + 'file/uploadIDCard',
							filePath: tempFilePaths[0],
							name: 'file',
							formData: {
								// 'files':tempFilePaths[i],
							},
							success: function(uploadFileRes) {
								uni.hideLoading();
								var datamain = JSON.parse(uploadFileRes.data);
								console.log(datamain);
								if (datamain.status == 200) {
									var url = datamain.data.domain + datamain.data.localPath;
									_this.simage1 = url;
									_this.ssecondPicId = datamain.data.id;
									console.log(url);
									var idCord = datamain.data.idCord;
									console.log("idCord",idCord);
									var startDate = idCord.ValidDate.substring(0,10);
									var stratArr =  startDate.split(".");
									_this.sdate2 = stratArr.join("-");
									_this.speriodStart = _this.sdate2;
									
									var startYear = Number(idCord.ValidDate.substring(0,4));
									var endYear = Number(idCord.ValidDate.substring(11,15));
									console.log(startYear,endYear);
									var qixian = endYear - startYear;
									if(qixian == 5){
										_this.index5 = 0;
									}
									if(qixian == 10){
										_this.index5 = 1;
									}
									if(qixian == 20){
										_this.index5 = 2;
									}
								} else {
									uni.showToast({
										title: datamain.msg,
										icon: 'none',
										duration: 1000
									})
								}
							},
							fail(e) {
								uni.hideLoading();
								uni.showToast({
									title: '上传失败',
									icon: 'none',
									duration: 1000
								})
							}
						});
					},
					error: function(e) {
						console.log(e);
						uni.showToast({
							title: '上传失败',
							icon: 'none',
							duration: 1000
						})
					}
				});

			},
			// sbindDateChange3: function(e) {
			// 	this.sdate3 = e.detail.value
			// 	this.speriodEnd = e.detail.value
			// },
			sbindDateChange2: function(e) {
				this.sdate2 = e.detail.value
				this.speriodStart = e.detail.value
			},
			// fbindDateChange1: function(e) {
			// 	console.log(e.detail.value);
			// 	this.fdate1 = e.detail.value
			// 	this.periodEnd = e.detail.value
			// },
			fbindDateChange: function(e) {
				console.log(e.detail.value);
				this.fdate = e.detail.value
				this.periodStart = e.detail.value
			},
			bindPickerChange: function(e) {
				var that = this;
				// console.log('picker发送选择改变，携带值为：' + e.detail.value);
				// console.log(e);
				var ii = e.detail.value;
				that.subjectType = that.array[ii].id;
				// console.log(that.subjectType);
				that.index = e.detail.value;
				// 如果类型不是企业，清空sqhQiniu字段
				if(that.index != "1"){
					this.sqhQiniu = "";
				}
				// if (ii != 0) {
				// 	that.zheng = true;
				// } else {
				// 	that.zheng = false;
				// }
				// if (ii == 2) {
				// 	that.han = true;
				// } else {
				// 	that.han = false;
				// }
			},
			// bindPickerChange1: function(e) {
			// 	var that = this;
			// 	console.log('picker发送选择改变，携带值为：' + e.detail.value);
			// 	// console.log(e);
			// 	var ii = e.detail.value;
			// 	that.zsid = that.array2[ii].id;
			// 	that.index2 = e.detail.value
			// },
			// 主体信息
			info() {
				var _this = this;
				uni.request({
					header: {
						'Content-Type': 'application/x-www-form-urlencoded', //自定义请求头信息
					},
					url: getApp().globalData.url + 'mch/getSubject/' + _this.mainid, //仅为示例，并非真实接口地址。
					method: 'post',
					data: {
						id: _this.mainid, //	用户ID（mainId）		true	string
					},
					success: (res) => {
						// uni.hideLoading(); //关闭加载动画
						console.log('info',res);
						if (res.data.status == '200') {
							if (res.data.data) {
								// _this.sqhQiniu = res.data.data.sqhQiniu;
								// _this.sqhUrl = res.data.data.sqhUrl;
								_this.types = 2; //判断之前是否上传过信息
								// console.log(res.data.data);
								_this.subjectType = res.data.data.subType.id; //主体类型
								for (let i = 0; i < _this.array.length; i++) {
									if (_this.array[i].id == _this.subjectType) {
										_this.index = i;
									}
								}
								// 受益人身份证信息
								_this.snumber = res.data.data.benIdCardVO.id; //	受益人身份证ID		false						string
								_this.fnumber = res.data.data.legalIdCardVO.id; //	法人身份证ID		false						string

								// 法人身份证信息获取
								if (_this.fnumber) {
									_this.fname = res.data.data.legalIdCardVO.name;
									// console.log(res.data.data.legalIdCardVO.periodEnd);
									_this.periodStart = res.data.data.legalIdCardVO.periodStart.split(' ')[0];
									_this.fdate = res.data.data.legalIdCardVO.periodStart.split(' ')[0];
									if (res.data.data.legalIdCardVO.periodEnd) {
										_this.periodEnd = res.data.data.legalIdCardVO.periodEnd.split(' ')[0];
										_this.fdate1 = res.data.data.legalIdCardVO.periodEnd.split(' ')[0];
										var years1 = res.data.data.legalIdCardVO.periodStart.split('-')[0];
										var years2 = res.data.data.legalIdCardVO.periodEnd.split('-')[0];
										var lastyear = years2 - years1;
										if (lastyear == 5) {
											_this.index4 = 0
										} else if (lastyear == 10) {
											_this.index4 = 1
										} else if (lastyear == 20) {
											_this.index4 = 2
										} else {
											_this.index4 = 3
										}
									} else {
										_this.periodEnd = '';
										_this.fdate1 = '';
										_this.index4 = 3
									}
									_this.mainPicId = res.data.data.legalIdCardVO.mainPic.id; //身份证正面照片id
									_this.secondPicId = res.data.data.legalIdCardVO.secondPic.id; //身份证反面照片id

									_this.fimage = res.data.data.legalIdCardVO.mainPic.domain + res.data.data
										.legalIdCardVO.mainPic.localPath;
									_this.fimage1 = res.data.data.legalIdCardVO.secondPic.domain + res.data
										.data.legalIdCardVO.secondPic.localPath; //身份证反面照片
								}
								// 受益人身份证信息获取
								if (_this.fnumber != _this.snumber && _this.snumber != '') {
									_this.han = true;
									_this.index3 = 1;
									_this.smainPicId = res.data.data.benIdCardVO.mainPic.id;
									_this.sname = res.data.data.benIdCardVO.name;
									_this.speriodStart = res.data.data.benIdCardVO.periodStart.split(' ')[0];
									console.log(_this.speriodStart);
									_this.sdate2 = res.data.data.benIdCardVO.periodStart.split(' ')[0];
									if (res.data.data.benIdCardVO.periodEnd) {
										_this.speriodEnd = res.data.data.benIdCardVO.periodEnd.split(' ')[0];
										_this.sdate3 = res.data.data.benIdCardVO.periodEnd.split(' ')[0];
										var years1 = res.data.data.benIdCardVO.periodStart.split('-')[0];
										var years2 = res.data.data.benIdCardVO.periodEnd.split('-')[0];
										var lastyear = years2 - years1;
										if (lastyear == 5) {
											_this.index5 = 0
										} else if (lastyear == 10) {
											_this.index5 = 1
										} else if (lastyear == 20) {
											_this.index5 = 2
										} else {
											_this.index5 = 3
										}
									} else {
										_this.speriodEnd = '';
										_this.sdate3 = '';
										_this.index5 = 3
									}

									_this.ssecondPicId = res.data.data.benIdCardVO.secondPic.id;
									_this.stypeId = res.data.data.benIdCardVO.idCardTypeVO.id;
									_this.simage = res.data.data.benIdCardVO.mainPic.domain + res.data.data
										.benIdCardVO.mainPic.localPath;
									_this.simage1 = res.data.data.benIdCardVO.secondPic.domain + res.data.data
										.benIdCardVO.secondPic.localPath; //身份证反面照片

									// 验证是否修改用的
									_this.smainPicId1 = res.data.data.benIdCardVO.mainPic.id;
									_this.sname1 = res.data.data.benIdCardVO.name;
									_this.speriodEnd1 = res.data.data.benIdCardVO.periodEnd.split(' ')[0];
									_this.speriodStart1 = res.data.data.benIdCardVO.periodStart.split(' ')[0];
									_this.ssecondPicId1 = res.data.data.benIdCardVO.secondPic.id;
									_this.stypeId1 = res.data.data.benIdCardVO.idCardTypeVO.id;
								} else {
									_this.han = false;
									_this.index3 = 0;
								}

								// 营业执照信息
								_this.licenseNumber = res.data.data.licenseVO.id; //	营业执照ID		false						string
								// console.log(res.data.data.licenseVO.id.length);
								_this.addressId = res.data.data.licenseVO.address
									.id; //	经营场所ID		false						string
								// console.log(res.data.data.licenseVO.address.lat);
								_this.latitude = res.data.data.licenseVO.address.lat;
								_this.longitude = res.data.data.licenseVO.address.lon;
								_this.latitude1 = res.data.data.licenseVO.address.lat;
								_this.longitude1 = res.data.data.licenseVO.address.lon;
								_this.adrname = res.data.data.licenseVO.address.name;
								_this.adrname1 = res.data.data.licenseVO.address.name;
								_this.mdxxdz = res.data.data.licenseVO.address.address;
								_this.mdxxdz1 = res.data.data.licenseVO.address.address;
								_this.yyzzid = res.data.data.licenseVO.mainPic
									.id; //	营业执照主图ID		false						string
								_this.yyzz = res.data.data.licenseVO.mainPic.domain + res.data.data.licenseVO
									.mainPic.localPath;
								_this.merchantName = res.data.data.mchName; //	商户名称		false						string
								_this.jyname = res.data.data.licenseVO.operaName; //	经营者姓名		false						string
								_this.zdate = res.data.data.licenseVO.registeredTime.split(' ')[
									0]; //	注册时间		false		string
								_this.jyfanwei = res.data.data.licenseVO.scope; //	经营范围		false						string
								// _this.mindex = res.data.data.licenseVO.type;
								// _this.belongType = res.data.data.licenseVO.type; //	类型		false	string		
								// 门店位置

								_this.dpickerid1 = res.data.data.licenseVO.address.province.id;
								_this.dpickerid2 = res.data.data.licenseVO.address.city.id;
								_this.dpickerid3 = res.data.data.licenseVO.address.area.id;
								_this.dpickerid4 = res.data.data.licenseVO.address.street.id;
								// console.log(_this.dpickerid1);
								// console.log(_this.dpickerid2);
								// console.log(_this.dpickerid3);
								// console.log(_this.dpickerid4);
								// _this.pid = res.data.data.provinceId;
								// _this.qid = res.data.data.areaId;
								// _this.cid = res.data.data.cityId;
								// _this.xid = res.data.data.streetId;
								_this.diqu = res.data.data.licenseVO.address.province.name + ',' + res.data
									.data.licenseVO.address.city.name + ',' + res.data.data.licenseVO.address
									.area.name + ',' + res.data.data.licenseVO.address.street.name;
								// _this.dadr;
								for (var i = 0; i < _this.dnui1.length; i++) {
									if (_this.dnui1[i].id == _this.dpickerid1) {
										// console.log(_this.dnui1[i].id);
										_this.dmultiIndex[0] = i;
									}
								}
								// console.log(_this.dpickerid1);
								_this.dadr1();
								// console.log(_this.diqu);
								// _this.xiaoqu();
							}
						}else{
						
						}
					},
					fail: (error) => {
						uni.showToast({
							title: '获取主体失败',
							icon: 'none',
							duration: 1000
						})
					}
				});
			},
			// 证件类型
			sfztype() {
				var _this = this;
				uni.request({
					header: {
						'Content-Type': 'application/json', //自定义请求头信息
					},
					url: getApp().globalData.url + 'mch/getIdCardTypeList', //仅为示例，并非真实接口地址。
					method: 'POST',
					data: {
						//	id: _this.mainid

					},
					success: (res) => {
						// console.log(res);
						// uni.hideLoading(); //关闭加载动画
						if (res.data.status == '200') {
							_this.array21 = res.data.data;
							_this.array22 = res.data.data;
							_this.stypeId = res.data.data[0].id;
							// _this.typeId = res.data.data[0].id;

							_this.zttype();
						} else {
							uni.showToast({
								title: '证件类型获取失败',
								icon: 'none',
								duration: 2000
							});
						}
					},
					fail: (error) => {
						uni.showToast({
							title: '证件类型获取失败',
							icon: 'none',
							duration: 2000
						});
					}
				});
			},
			// 经营类型
			zttype() {
				var _this = this;
				uni.request({
					header: {
						'Content-Type': 'application/json', //自定义请求头信息
					},
					url: getApp().globalData.url + 'mch/getSubTypeList', //仅为示例，并非真实接口地址。
					method: 'post',
					data: {
						//id: _this.mainid, //	用户ID（mainId）		true	string
					},
					success: (res) => {
						// uni.hideLoading(); //关闭加载动画
						// console.log(res);

						if (res.data.status == '200') {
							_this.array = res.data.data;
							_this.subjectType = res.data.data[0].id;
						} else {
							uni.showToast({
								title: '经营类型获取失败',
								icon: 'none',
								duration: 2000
							});
						}
					},
					fail: (error) => {
						uni.showToast({
							title: '经营类型获取失败',
							icon: 'none',
							duration: 2000
						});
					}
				});
			},
			xiugai() {
				var _this = this;
				if (_this.checks === false) {
					return
				}
				if (!_this.merchantName) {
					uni.showToast({
						title: '请输入商户名称',
						icon: 'none',
						duration: 2000
					});
					return
				}
				if (!_this.yyzz) {
					uni.showToast({
						title: '请上传营业执照照片',
						icon: 'none',
						duration: 2000
					});
					return
				}
				if (!_this.licenseNumber) {
					uni.showToast({
						title: '请输入营业执照编码',
						icon: 'none',
						duration: 2000
					});
					return
				}
				// if (!_this.jyname) {
				// 	uni.showToast({
				// 		title: '请输入经营者姓名',
				// 		icon: 'none',
				// 		duration: 2000
				// 	});
				// 	return
				// }
				if (!_this.jyfanwei) {
					uni.showToast({
						title: '请输入经营范围',
						icon: 'none',
						duration: 2000
					});
					return
				}
				if (!_this.shmd) {
					uni.showToast({
						title: '请输入门店名称',
						icon: 'none',
						duration: 2000
					});
					return
				}
				// if (!_this.kefu) {
				// 	uni.showToast({
				// 		title: '请输入客服电话',
				// 		icon: 'none',
				// 		duration: 2000
				// 	});
				// 	return
				// }
				if (!_this.longitude) {
					uni.showToast({
						title: '请选择门店详细位置',
						icon: 'none',
						duration: 2000
					});
					return
				}
				if (!_this.mdxxdz) {
					uni.showToast({
						title: '请输入门店详细地址',
						icon: 'none',
						duration: 2000
					});
					return
				}
				_this.mdidlisti = '';
				_this.dnidlisti = '';
				// console.log(_this.imgfo);
				// if (_this.imgfo == 1) {
				if (_this.mdidlist.length <= 0) {
					uni.showToast({
						title: '请上传门店门头照片',
						icon: 'none',
						duration: 2000
					});
					return
				}
				for (var i = 0; i < _this.mdidlist.length; i++) {
					if (i == 0) {
						_this.mdidlisti = _this.mdidlist[i];
					} else {
						_this.mdidlisti = _this.mdidlisti + ',' + _this.mdidlist[i];
					}
				}
				// console.log(_this.mdidlist, _this.dnidlist);
				if (_this.dnidlist.length > 0) {
					for (var i = 0; i < _this.dnidlist.length; i++) {
						if (i == 0) {
							_this.dnidlisti = _this.dnidlist[i];
						} else {
							_this.dnidlisti = _this.dnidlisti + ',' + _this.dnidlist[i];
						}
					}
				}
				// }
				if (!_this.fname) {
					uni.showToast({
						title: '请输入法人姓名',
						icon: 'none',
						duration: 2000
					});
					return
				}
				console.log(_this.fnumber);
				if (!_this.fnumber) {
					uni.showToast({
						title: '请输入法人身份证号码',
						icon: 'none',
						duration: 2000
					});
					return
				}
				if (!_this.mainPicId) {
					uni.showToast({
						title: '请上传身份证人像面照片',
						icon: 'none',
						duration: 2000
					});
					return
				}
				if (!_this.secondPicId) {
					uni.showToast({
						title: '请上传身份证国徽面照片',
						icon: 'none',
						duration: 2000
					});
					return
				}
				if (_this.han == true) {

					if (!_this.sname) {
						uni.showToast({
							title: '请输入受益人姓名',
							icon: 'none',
							duration: 2000
						});
						return
					}
					if (!_this.snumber) {
						uni.showToast({
							title: '请输入受益人身份证号码',
							icon: 'none',
							duration: 2000
						});
						return
					}
					if (!_this.smainPicId) {
						uni.showToast({
							title: '请上传受益人身份证人像面照片',
							icon: 'none',
							duration: 2000
						});
						return
					}
					if (!_this.ssecondPicId) {
						uni.showToast({
							title: '请上传受益人身份证国徽面照片',
							icon: 'none',
							duration: 2000
						});
						return
					}
				}
				_this.checks = false
				uni.showLoading();
				_this.adrchange();
			},
			queding() {
				var _this = this;
				_this.types=1
				if (_this.types == 2) {
					uni.navigateTo({
						url: '/pages/shenqing/shenqing_jiesuan'
					});
				} else if (_this.types == 1) {
					// if (_this.checks == false) {
					// 	return
					// }
					if (!_this.merchantName) {
						uni.showToast({
							title: '请输入商户名称',
							icon: 'none',
							duration: 2000
						});
						return
					}
					if (!_this.yyzz) {
						uni.showToast({
							title: '请上传营业执照照片',
							icon: 'none',
							duration: 2000
						});
						return
					}
					if (!_this.licenseNumber) {
						uni.showToast({
							title: '请输入营业执照编码',
							icon: 'none',
							duration: 2000
						});
						return
					}
					// if (!_this.jyname) {
					// 	uni.showToast({
					// 		title: '请输入经营者姓名',
					// 		icon: 'none',
					// 		duration: 2000
					// 	});
					// 	return
					// }
					if (!_this.jyfanwei) {
						uni.showToast({
							title: '请输入经营范围',
							icon: 'none',
							duration: 2000
						});
						return
					}
					if (!_this.shmd) {
						uni.showToast({
							title: '请输入门店名称',
							icon: 'none',
							duration: 2000
						});
						return
					}
					// if (!_this.kefu) {
					// 	uni.showToast({
					// 		title: '请输入客服电话',
					// 		icon: 'none',
					// 		duration: 2000
					// 	});
					// 	return
					// }
					console.log(_this.longitude);
					if (!_this.longitude) {
						uni.showToast({
							title: '请选择门店详细位置',
							icon: 'none',
							duration: 2000
						});
						return
					}
					if (!_this.mdxxdz) {
						uni.showToast({
							title: '请输入门店详细地址',
							icon: 'none',
							duration: 2000
						});
						return
					}
					_this.mdidlisti = '';
					_this.dnidlisti = '';
					// if (_this.imgfo == 1) {

					if (_this.mdidlist.length <= 0) {
						uni.showToast({
							title: '请上传门店门头照片',
							icon: 'none',
							duration: 2000
						});
						return
					}
					for (var i = 0; i < _this.mdidlist.length; i++) {
						if (i == 0) {
							_this.mdidlisti = _this.mdidlist[i];
						} else {
							_this.mdidlisti = _this.mdidlisti + ',' + _this.mdidlist[i];
						}
					}
					// console.log(_this.mdidlist, _this.dnidlist);
					if (_this.dnidlist.length > 0) {
						// uni.showToast({
						// 	title: '请上传店内环境照片',
						// 	icon: 'none',
						// 	duration: 2000
						// });
						// return
						for (var i = 0; i < _this.dnidlist.length; i++) {
							if (i == 0) {
								_this.dnidlisti = _this.dnidlist[i];
							} else {
								_this.dnidlisti = _this.dnidlisti + ',' + _this.dnidlist[i];
							}
						}
					}
					// }
					if (!_this.fname) {
						uni.showToast({
							title: '请输入法人姓名',
							icon: 'none',
							duration: 2000
						});
						return
					}
					console.log(_this.fnumber);
					if (!_this.fnumber) {
						uni.showToast({
							title: '请输入法人身份证号码',
							icon: 'none',
							duration: 2000
						});
						return
					}
					if (!_this.mainPicId) {
						uni.showToast({
							title: '请上传身份证人像面照片',
							icon: 'none',
							duration: 2000
						});
						return
					}
					if (!_this.secondPicId) {
						uni.showToast({
							title: '请上传身份证国徽面照片',
							icon: 'none',
							duration: 2000
						});
						return
					}
					if (_this.han == true) {

						if (!_this.sname) {
							uni.showToast({
								title: '请输入受益人姓名',
								icon: 'none',
								duration: 2000
							});
							return
						}
						if (!_this.snumber) {
							uni.showToast({
								title: '请输入受益人身份证号码',
								icon: 'none',
								duration: 2000
							});
							return
						}
						if (!_this.smainPicId) {
							uni.showToast({
								title: '请上传受益人身份证人像面照片',
								icon: 'none',
								duration: 2000
							});
							return
						}
						if (!_this.ssecondPicId) {
							uni.showToast({
								title: '请上传受益人身份证国徽面照片',
								icon: 'none',
								duration: 2000
							});
							return
						}
					}
					// _this.checks = false
					uni.showLoading();
					_this.adrchange();
				}
			},
			// 上传修改门店地址
			adrchange() {
				var _this = this;
				uni.request({
					header: {
						'Content-Type': 'application/json', //自定义请求头信息
					},
					url: getApp().globalData.url + 'area/saveOrUpdateAddress', //仅为示例，并非真实接口地址。
					method: 'POST',
					data: {
						address: _this.mdxxdz, ////	详细地址		false	string
						areaId: _this.dpickerid3, //	区		false	string
						cityId: _this.dpickerid2, //	市		false	string
						id: _this.adrid, //	id		false	string
						lat: _this.latitude, //'36.461843', //	纬度		false	string
						lon: _this.longitude, //'116.043516',//	经度		false	string
						name: _this.adrname, //	小区名		false	string
						provinceId: _this.dpickerid1, //	省		false	string
						streetId: _this.dpickerid4, //
					},
					success: (res) => {
						console.log('saveOrUpdateAddress:',res);
						uni.hideLoading(); //关闭加载动画
						// _this.checks = true
						if (res.data.status == '200') {
							_this.addressId = res.data.data;
							console.log(res.data.data);
							_this.jingying(res.data.data);
						} else if (res.data.status == '501') {
							let str = "";
							for (var a in res.data.data) str += res.data.data[a] + ";\n";
							console.log(_this.strs)
							if (_this.strs == '') {
								_this.strs = str;
							} else {
								_this.strs = _this.strs + ';' + str;
							}
						} else {

							uni.showToast({
								title: '门店地址提交失败',
								icon: 'none',
								duration: 2000
							});
						}
					},
					fail: (error) => {
						// _this.checks = true
						uni.showToast({
							title: '门店地址提交失败',
							icon: 'none',
							duration: 2000
						});
					}
				});
			},

			// 上传修改营业执照
			jingying(addressId) {
				var _this = this;
				var data = {
					addressId: addressId, //	经营场所		false							string
					id: _this.licenseNumber.toUpperCase(), //		id		false							string
					mainId: _this.yyzzid, //		主图ID		false							string
					name: _this.merchantName, //		名称		false							string
					//operaName: _this.jyname, //		经营者姓名		false							string
					operaName: _this.fname,
					registeredTime: _this.zdate + ' 00:00:00', //		注册时间		false							string
					scope: _this.jyfanwei, //		经营范围		false							string
					type: _this.subjectType, //		类型		false							string
				};
				console.log(data)
				uni.request({
					header: {
						'Content-Type': 'application/json', //自定义请求头信息
					},
					url: getApp().globalData.url + 'mch/saveOrUpdateLicense', //仅为示例，并非真实接口地址。
					method: 'post',
					data: data,
					success: (res) => {
						console.log('saveOrUpdateLicense:',res);
						if (res.data.status == '200') {
							// console.log(res.data.data);
							// _this.licensePicId=res.data.data;
							_this.jyzl();
						} else if (res.data.status == '501') {
							let str = "";
							for (var a in res.data.data) str += res.data.data[a] + ";\n";
							if (_this.strs == '') {
								_this.strs = str;
							} else {
								_this.strs = _this.strs + ';' + str;
							}
							// uni.showToast({
							// 	title: str,
							// 	icon: 'none',
							// 	duration: 3000
							// });
						} else {
							uni.showToast({
								title: '营业执照提交失败',
								icon: 'none',
								duration: 2000
							});
						}
					},
					fail: (error) => {
						uni.showToast({
							title: '营业执照提交失败',
							icon: 'none',
							duration: 2000
						});
					}
				});
			},
			// 上传修改经营资料
			jyzl() {
				var _this = this;
				console.log(_this.mdidlisti, _this.dnidlisti);
				var data = {
					addressId: _this.addressId, //	门店地址		false	string
					id: _this.mainid, //	id		false		string
					mainIds: _this.mdidlisti, //	门头照片组		false	string
					name: _this.merchantName, //	门店名称		false string
					phone: _this.kefu, //	客服电话		false	string
					scenesTypeId: 2, //	场景类型Id		false		string
					secondIds: _this.dnidlisti, //	店内照片组		false	string
					shortName: _this.shmd, //	门店简称		false		string

				};
				uni.request({
					header: {
						'Content-Type': 'application/json', //自定义请求头信息
					},
					url: getApp().globalData.url + 'mch/updateInfo', //仅为示例，并非真实接口地址。
					method: 'post',
					data: data,
					success: (res) => {
						console.log(res);
						if (res.data.status == '200') {
							_this.shenfenzheng();
						} else if (res.data.status == '501') {
							let str = "";
							for (var a in res.data.data) str += res.data.data[a] + ";\n";
							if (_this.strs == '') {
								_this.strs = str;
							} else {
								_this.strs = _this.strs + ';' + str;
							}
						} else {
							uni.showToast({
								title: '经营资料提交失败',
								icon: 'none',
								duration: 2000
							});
						}
					},
					fail: (error) => {
						uni.showToast({
							title: '经营资料提交失败',
							icon: 'none',
							duration: 2000
						});
					}
				});
			},
			zhuti() {
				var _this = this;
				if (_this.han == false) {
					_this.snumber = _this.fnumber;
				}
				console.log(_this.snumber, _this.fnumber, _this.licenseNumber, _this.merchantName, _this.subjectType);
				var data = {
					benIdCard: _this.snumber, //	受益人身份证ID		false						string
					id: _this.mainid, //	id		false						string
					legalIdCard: _this.fnumber, //	法人身份证ID		false						string
					licenseId: _this.licenseNumber.toUpperCase(), //	营业执照ID		false						string
					mchName: _this.merchantName, //	商户名称		false						string
					subTypeId: _this.subjectType,//	主体类型ID		false						string
					name:_this.fname
					// sqhQiniu: _this.sqhQiniu || "",
					// sqhUrl: _this.sqhUrl
				};
				data = JSON.stringify(data);
				uni.request({
					header: {
						'Content-Type': 'application/json', //自定义请求头信息
					},
					url: getApp().globalData.url + 'mch/updateSubject', //仅为示例，并非真实接口地址。
					method: 'post',
					data: data,
					success: (res) => {
						console.log(res);
						if (res.data.status == '200') {
							_this.info();
							_this.jyinfo();
							uni.showToast({
								title: '主体信息提交成功',
								icon: 'none',
								duration: 2000
							});
							setTimeout(function() {
								uni.navigateTo({
									url: '/pages/shenqing/shenqing_jiesuan'
								});
							}, 2000)
						} else if (res.data.status == '501') {
							let str = "";
							for (var a in res.data.data) str += res.data.data[a] + ";\n";
							if (_this.strs == '') {
								_this.strs = str;
							} else {
								_this.strs = _this.strs + ';' + str;
							}
						} else {
							uni.showToast({
								title: '主体信息提交失败',
								icon: 'none',
								duration: 2000
							});
						}
					},
					fail: (error) => {

						uni.showToast({
							title: '主体信息提交失败',
							icon: 'none',
							duration: 2000
						});
					}
				});
			},
			// 法人身份证
			shenfenzheng() {
				var _this = this;

				var periodStart = _this.periodStart + ' 00:00:00';
				// console.log(this.fdate);
				var years = this.fdate.split("-")[0];
				if (this.index4 == 0) {
					years = Number(years) + 5;
					this.periodEnd = years + '-' + this.fdate.split("-")[1] + '-' + this.fdate.split("-")[2] + ' 00:00:00';
				} else if (this.index4 == 1) {
					years = Number(years) + 10;
					this.periodEnd = years + '-' + this.fdate.split("-")[1] + '-' + this.fdate.split("-")[2] + ' 00:00:00';
				} else if (this.index4 == 2) {
					years = Number(years) + 20;
					this.periodEnd = years + '-' + this.fdate.split("-")[1] + '-' + this.fdate.split("-")[2] + ' 00:00:00';
				} else {
					this.periodEnd = ''
				}
				console.log(this.periodEnd);
				console.log(_this.fnumber, _this.mainPicId, _this.fname, _this.periodEnd, periodStart, _this.secondPicId);

				//    	{
				// 	id: '372425197912224370', //	id		false	string
				// 	mainId:'1420591643124400130', //		正面ID		false	string
				// 	name: '孟祥森', //		姓名		false	string
				// 	periodEnd:'2031-06-03 00:00:00', //		有效期结束		false	string
				// 	periodStart: '2011-06-03 00:00:00', //		有效期开始		false	string
				// 	secondId: '1420591668676100098', //		反面ID		false	string
				// }

				var data = {
					id: _this.fnumber, //	id		false	string
					mainId: _this.mainPicId, //		正面ID		false	string
					name: _this.fname, //		姓名		false	string
					periodEnd: _this.periodEnd, //		有效期结束		false	string
					periodStart: periodStart, //		有效期开始		false	string
					secondId: _this.secondPicId, //		反面ID		false	string
					address: _this.sfzAddress //		身份证地址
				};
				// data = JSON.stringify(data);
				uni.request({
					header: {
						'Content-Type': 'application/json', //自定义请求头信息
					},
					url: getApp().globalData.url + 'mch/saveOrUpdateIdCard', //仅为示例，并非真实接口地址。
					method: 'post',
					data: data,
					success: (res) => {
						// _this.checks = true
						// uni.hideLoading();
						console.log(res);
						if (res.data.status == '200') {
							// _this.legalIdCardId = res.data.data.id;
							console.log(_this.han);
							if (_this.han == false) {
								_this.zhuti();
							} else {
								_this.shenfenzheng1();
							}
						} else if (res.data.status == '501') {
							let str = "";
							for (var a in res.data.data) str += res.data.data[a] + ";\n";
							if (_this.strs == '') {
								_this.strs = str;
							} else {
								_this.strs = _this.strs + ';' + str;
							}
							// uni.showToast({
							// 	title: str,
							// 	icon: 'none',
							// 	duration: 3000
							// });
						} else {

							uni.showToast({
								title: '法人身份证提交失败',
								icon: 'none',
								duration: 2000
							});
						}
					},
					fail: (error) => {
						// _this.checks = true

						uni.showToast({
							title: '法人身份证提交失败',
							icon: 'none',
							duration: 2000
						});
					}
				});
			},
			// 受益人身份证
			shenfenzheng1() {
				var _this = this;
				var speriodStart = _this.speriodStart + ' 00:00:00';
				console.log(this.sdate2);
				var years = this.sdate2.split("-")[0];
				if (this.index5 == 0) {
					years = Number(years) + 5;
					this.speriodEnd = years + '-' + this.sdate2.split("-")[1] + '-' + this.sdate2.split("-")[2] +
						' 00:00:00';
				} else if (this.index5 == 1) {
					years = Number(years) + 10;
					this.speriodEnd = years + '-' + this.sdate2.split("-")[1] + '-' + this.sdate2.split("-")[2] +
						' 00:00:00';
				} else if (this.index5 == 2) {
					years = Number(years) + 20;
					this.speriodEnd = years + '-' + this.sdate2.split("-")[1] + '-' + this.sdate2.split("-")[2] +
						' 00:00:00';
				} else {
					this.speriodEnd = ''
				}
				console.log(_this.snumber, _this.smainPicId, _this.ssecondPicId, this.speriodEnd, speriodStart, _this
					.sname);
				var data = {
					id: _this.snumber, //	id		false	string
					mainId: _this.smainPicId, //		正面ID		false	string
					name: _this.sname, //		姓名		false	string
					periodEnd: _this.speriodEnd, //		有效期结束		false	string
					periodStart: speriodStart, //		有效期开始		false	string
					secondId: _this.ssecondPicId, //		反面ID		false	string
					address: _this.sfzAddress //		身份证地址
				};
				console.log(data)
				// data = JSON.stringify(data);
				uni.request({
					header: {
						'Content-Type': 'application/json', //自定义请求头信息
					},
					url: getApp().globalData.url + 'mch/saveOrUpdateIdCard', //仅为示例，并非真实接口地址。
					method: 'post',
					data: data,
					success: (res) => {
						console.log(res);
						if (res.data.status == '200') {
							_this.zhuti();
						} else if (res.data.status == '501') {
							let str = "";
							for (var a in res.data.data) str += res.data.data[a] + ";\n";
							if (_this.strs == '') {
								_this.strs = str;
							} else {
								_this.strs = _this.strs + ';' + str;
							}
						} else {

							uni.showToast({
								title: '受益人身份证提交失败',
								icon: 'none',
								duration: 2000
							});
						}
					},
					fail: (error) => {

						uni.showToast({
							title: '受益人身份证提交失败',
							icon: 'none',
							duration: 2000
						});
					}
				});
			},
		}
	}
</script>

<style>
	.imgi image.del {
		width: 6vw;
		height: 6vw;
		display: block;
		position: absolute;
		background: url(../../static/img/bg.png) repeat;
		top: 0;
		right: 0;
		z-index: 9;
	}

	.baodan_into {
		width: 100%;
		height: auto;
		display: block;
		float: left;
		line-height: 7vw;
		display: block;
		float: left;
		min-height: 40vw;
		background: url(../../static/img/jiaa.png) no-repeat center;
	}

	.baodan_into_image {
		width: 90%;
		height: auto;
		display: block;
		float: left;
		margin: 0 5%;
	}

	.shuru_text1 {
		width: 100%;
		height: 10vw;
		line-height: 10vw;
		display: block;
		float: left;
	}

	.shuru_text2 {
		width: 45%;
		height: auto;
		min-height: 6vw;
		float: left;
		background: url(../../static/img/turn.png) no-repeat right center;
		background-size: 3vw;
		line-height: 6vw;
		text-align: right;
		padding: 2vw 0;
		padding-right: 4vw;
	}

	.baodan_into1 {
		width: 30%;
		height: 24vw;
		display: block;
		float: left;
		line-height: 7vw;
		display: block;
		float: left;
		background: url(../../static/img/jiaa.png) no-repeat center;
		border: 1px solid #eee;
		border-radius: 2vw;
		margin: 2vw 1.6%;
	}

	.imgi {
		width: 30%;
		height: 24vw;
		display: block;
		float: left;
		border: 1px solid #eee;
		margin: 2vw 1.6%;
		border-radius: 2vw;
		overflow: hidden;
		position: relative;
	}

	.imgi image {
		width: 100%;
		height: 100%;
		display: block;
		float: left;
	}

	.baodan_into_image {
		width: 90%;
		height: auto;
		display: block;
		float: left;
		margin: 0 5%;
	}

	.bai {
		width: 100%;
		height: 30vw;
		display: block;
		float: left;
	}

	.center_qb {
		width: 100%;
		height: auto;
		line-height: 8vw;
		display: block;
		float: left;
		padding: 2vw 0;
	}

	.login_main_li_yzm {
		width: auto;
		height: 8vw;
		display: block;
		float: right;
		background: #fcbe16;
		padding: 0 3vw;
		line-height: 8vw;
		border-radius: 4vw;
	}

	.shuru {
		width: 100%;
		height: auto;
		display: block;
		float: left;
		border-radius: 1vw;
		overflow: hidden;
		padding: 2vw 4vw;
		background: #fff;
		margin-top: 4vw;
		box-shadow: 0px 0px 5px #eee;
	}

	.shuru_tit {
		width: 50%;
		height: 10vw;
		line-height: 10vw;
		display: block;
		float: left;
	}

	.shuru_text {
		width: 50%;
		height: 10vw;
		line-height: 10vw;
		display: block;
		float: right;
		text-align: right;
	}

	select.shuru_text {
		border: none;
	}



	.baodan_zhu {
		width: 100%;
		height: auto;
		display: block;
		float: left;
		margin: 2vw 0;
		background: #fff;
		border-radius: 1vw;
		padding: 4vw;
		box-shadow: 0px 0px 5px #eee;
		margin-top: 4vw;
	}

	.baodan_tit {
		width: 100%;
		height: 8vw;
		line-height: 8vw;
		display: block;
		float: left;
		text-align: center;
	}

	.baodan_into {
		width: 100%;
		height: auto;
		display: block;
		float: left;
		line-height: 7vw;
		display: block;
		float: left;
		min-height: 40vw;
		background: url(../../static/img/jiaa.png) no-repeat center;
	}

	.baodan_into_image {
		width: 90%;
		height: auto;
		display: block;
		float: left;
		margin: 0 5%;
	}

	.shuru_text1 {
		width: 100%;
		height: 10vw;
		line-height: 10vw;
		display: block;
		float: left;
	}

	/* 	.shuru_text2 {
		background: url(../../static/img/turn.png) no-repeat right center;
		background-size: 3vw;
		line-height: 10vw;
		text-align: right;
		padding-right: 4vw;
		height: 10vw;
		overflow: hidden;
	}
 */
	.baodan_into_image_load {
		width: 20vw;
		height: 20vw;
		position: absolute;
		top: 12vw;
		left: 50%;
		z-index: 999;
		background: #000;
		padding: 7vw;
		border-radius: 3vw;
		margin-left: -10vw;
	}
	.tuic11{
		margin-bottom: 5vw;
	}
</style>
